home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Fonts / FontSize.cp < prev    next >
Text File  |  2000-06-23  |  996b  |  59 lines

  1. // FontSize.cp
  2.  
  3. #ifndef FontSize_h
  4. #include "FontSize.h"
  5. #endif
  6.  
  7. #include <Fonts.h>
  8.  
  9. FontSize::FontSize( uint16 value )
  10.   : size( ( value == 0 ) ? Default().Value() : value )
  11.   {
  12.   }
  13.  
  14. FontSize FontSize::Default()
  15.   {
  16.     static int16 size = GetDefFontSize();
  17.     return FontSize( size );
  18.   }
  19.  
  20. void FontSize::operator+=( int16 d )
  21.   {
  22.     int32 result = int32( size ) + int32( d );
  23.     
  24.     Assert( result > 0 );
  25.     Assert( result <= maxint16 );
  26.     
  27.     size = result;
  28.   }
  29.  
  30. void FontSize::operator-=( int16 d )
  31.   {
  32.     int32 result = int32( size ) - int32( d );
  33.     
  34.     Assert( result > 0 );
  35.     Assert( result <= maxint16 );
  36.  
  37.     size  = result;
  38.   }
  39.  
  40. const FontSize FontSize::operator+( int16 d ) const
  41.   {
  42.     int32 result = int32( size ) + int32( d );
  43.     
  44.     Assert( result > 0 );
  45.     Assert( result <= maxint16 );
  46.     
  47.     return FontSize( result );
  48.   }
  49.  
  50. const FontSize FontSize::operator-( int16 d ) const
  51.   {
  52.     int32 result = int32( size ) - int32( d );
  53.     
  54.     Assert( result > 0 );
  55.     Assert( result <= maxint16 );
  56.     
  57.     return FontSize( result );
  58.   }
  59.